package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.assistant.common.vo.BaseVO;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduUnionSchool.EduUnionSchoolKeyVO;
import com.jwsoft.manager.common.vo.eduUnionSchool.EduUnionSchoolQueryVO;
import com.jwsoft.manager.common.vo.eduUnionSchool.EduUnionSchoolVO;
import com.jwsoft.manager.common.vo.eduUnionSchoolDetail.EduUnionSchoolDetailKeyVO;
import com.jwsoft.manager.core.integration.EduUnionSchoolIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 户籍跨校联合区表网关
 *
 * @author wangtao
 * @since 2022-12-22
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "户籍跨校联合区表", description = "户籍跨校联合区表")
public class EduUnionSchoolController {

    @Autowired
    public EduUnionSchoolIntegration eduUnionSchoolIntegration;

    @Operation(summary = "户籍跨校联合区表分页查询",description = "户籍跨校联合区表分页查询")
    @PostMapping(value = "/eduUnionSchool0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduUnionSchoolVO>> getList(@RequestBody @Validated EduUnionSchoolQueryVO vo) {
        return AppResponse.successData(eduUnionSchoolIntegration.getList(vo));
    }

    @Operation(summary = "户籍跨校联合区表根据主键查询详情",description = "户籍跨校联合区表根据主键查询详情")
    @PostMapping(value = "/eduUnionSchool0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduUnionSchoolVO> getById(@RequestBody @Validated EduUnionSchoolKeyVO vo) {
        return AppResponse.successData(eduUnionSchoolIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "户籍跨校联合区表新增",description = "户籍跨校联合区表新增")
    @PostMapping(value = "/eduUnionSchool0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduUnionSchoolVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduUnionSchoolVO vo) {
        return AppResponse.successData(eduUnionSchoolIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "户籍跨校联合区表修改",description = "户籍跨校联合区表修改")
    @PostMapping(value = "/eduUnionSchool0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduUnionSchoolVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduUnionSchoolVO vo) {
        return AppResponse.successData(eduUnionSchoolIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "户籍跨校联合区表删除",description = "户籍跨校联合区表删除")
    @PostMapping(value = "/eduUnionSchool0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduUnionSchoolKeyVO vo) {
        eduUnionSchoolIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
    @Operation(summary = "联合区关联学校查询",description = "联合区关联学校查询")
    @PostMapping(value = "/eduUnionSchool0007", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduUnionSchoolVO>> getUnionSchoolQuery(@RequestBody @Validated EduUnionSchoolQueryVO vo) {
        return AppResponse.successData(eduUnionSchoolIntegration.getUnionSchoolQuery(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "联合区关联学校删除",description = "联合区关联学校删除")
    @PostMapping(value = "/eduUnionSchool0008", produces = "application/json;charset=UTF-8")
    public AppResponse getUnionSchoolDelete(@RequestBody @Validated EduUnionSchoolDetailKeyVO vo) {
        eduUnionSchoolIntegration.getUnionSchoolDelete(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "联合区关联学校新增",description = "联合区关联学校新增")
    @PostMapping(value = "/eduUnionSchool0009", produces = "application/json;charset=UTF-8")
    public AppResponse<EduUnionSchoolVO> getUnionSchoolInsert(@RequestBody @Validated(value = {Validators.Add.class}) EduUnionSchoolVO vo) {
        return AppResponse.successData(eduUnionSchoolIntegration.getUnionSchoolInsert(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "户籍跨校联合区复制上年度数据",description = "户籍跨校联合区复制上年度数据")
    @PostMapping(value = "/eduUnionSchool0010", produces = "application/json;charset=UTF-8")
    public AppResponse init(@RequestBody BaseVO vo) {
        eduUnionSchoolIntegration.init(vo);
        return AppResponse.successMsg("初始化成功！");
    }

}
